import Vue from 'vue'
import App from './App.vue'
import router from '@/router/index'
import {jwtDecode} from 'jwt-decode'
//引入插件
import ElementUI from 'element-ui';
//引入css文件
import 'element-ui/lib/theme-chalk/index.css';
import Axios from "axios"
Vue.prototype.$axios = Axios
//全局使用插件
Vue.use(ElementUI);
//  router: router
// key value相同的时候可以简写为   router
//全局引入echarts
import * as echarts from 'echarts';
//需要挂载到Vue原型上
Vue.prototype.$echarts = echarts;

Vue.config.productionTip = false
router.beforeEach((to, from, next)=>{
	if(to.path == '/login'){
		next();
	}else{
		if(window.sessionStorage.getItem('token')){
			next();
		}else{
		next('/login');
		}
	}
})
new Vue({
  render: h => h(App),
  router
}).$mount('#app')
// 拦截器
// 路由拦截


